<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
//专业管理 majorAdmin
//调用  路由-> 控制器
//新增管理的员的控制器 start
Route::any('/getAllmajor', 'Admin1Controller@getAllmajor');
Route::any('/changeMajor', 'Admin1Controller@changeMajor');
Route::any('/removeMajor', 'Admin1Controller@removeMajor');
//新增管理的员的控制器 end

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});

Route::any('getMajorlist', 'MajorlistController@majorlist');

//管理员
Route::prefix('admin')->middleware(['token:admin'])->group(function () {

//    2021 5 11 新增 start
//    获取 活动时间
    Route::any('getActivityTime', 'AdminController@getActivityTime');
//    更改活动时间
    Route::post('changeActivityTime', 'AdminController@changeActivityTime');


//    2021 5 11 新增 end


    //登录
    Route::post('login', 'AdminController@login_POST');

    //导入学生[成绩]
    Route::post('students', 'AdminController@students_POST');

    //导入[修改]学生成绩
    Route::post('scores', 'AdminController@scores_POST');

    //查看学生
    Route::get('students', 'AdminController@students_GET');

    //搜索
    Route::get('search', 'AdminController@search_GET');

    //志愿、成绩修改
    Route::put('score_wish', 'AdminController@score_wish_PUT');

    //修改综合成绩的算法
    Route::post('scorerule','AdminController@scorerule_POST');

    //获得当前大二班级
    Route::get('class2','AdminController@class2_GET');

    //大二班级管理
    Route::post('class2','AdminController@class2_POST');

    //自动分班开始
    Route::any('classchanges','AdminController@classchanges_GET');

    //获取当前班级容量，以及第一志愿填报数量
    Route::get('peoplecount','PublicController@peoplecount_GET');


});




//学生
Route::prefix('stu')->middleware(['token:stu'])->group(function(){
    //登录
    Route::post('login', 'StudentController@login_POST');

    //修改 志愿
    Route::post('wish', 'StudentController@wish_POST');

    //获取当前班级容量，以及第一志愿填报数量
    Route::get('peoplecount','PublicController@peoplecount_GET');

    //获取自身信息
    Route::get('self','StudentController@self_GET');

    //修改密码，返回token
    Route::post('pwd','StudentController@pwd_POST');
});

//用户通用
Route::middleware(['token:all'])->group(function(){
    //获取公共配置
    Route::get('config', 'PublicController@config_GET');
});
//当前志愿人数情况
Route::get('peoplecount','PublicController@peoplecount_GET');

//错误页面
Route::fallback(function () {
    return response()->json(['message' => 'Not Found!'], 404);
});
